Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some of the lint-addons warnings and errors #26388

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

hybridherbst
Copy link
Contributor

Description

Running npm run lint-addons unveils quite a number of small formatting issues;
the ones that were clear to me are fixed with this PR (so that using linting is more useful again).

Before:

✖ 68 problems (39 errors, 29 warnings)

After:

✖ 32 problems (3 errors, 29 warnings)

The remaining warnings are almost all from jsm/renderers/common/Backend.js and a few async import warnings that the linter probably is not configured to understand:

/Users/herbst/git/three/examples/jsm/capabilities/WebGPU.js
  11:18  error  Parsing error: Cannot use keyword 'await' outside an async function

/Users/herbst/git/three/examples/jsm/physics/RapierPhysics.js
  41:18  error  Parsing error: Unexpected token import

/Users/herbst/git/three/examples/jsm/renderers/common/Backend.js
  25:9   warning  'renderContext' is defined but never used  no-unused-vars
  27:10  warning  'renderContext' is defined but never used  no-unused-vars
  31:8   warning  'renderObject' is defined but never used   no-unused-vars
  31:22  warning  'info' is defined but never used           no-unused-vars
  35:17  warning  'program' is defined but never used        no-unused-vars
  37:18  warning  'program' is defined but never used        no-unused-vars
  41:18  warning  'renderObject' is defined but never used   no-unused-vars
  43:18  warning  'renderObject' is defined but never used   no-unused-vars
  47:24  warning  'renderObject' is defined but never used   no-unused-vars
  49:25  warning  'computeNode' is defined but never used    no-unused-vars
  49:38  warning  'pipeline' is defined but never used       no-unused-vars
  51:19  warning  'pipeline' is defined but never used       no-unused-vars
  55:15  warning  'renderObject' is defined but never used   no-unused-vars
  57:15  warning  'renderObject' is defined but never used   no-unused-vars
  61:21  warning  'renderObject' is defined but never used   no-unused-vars
  65:17  warning  'texture' is defined but never used        no-unused-vars
  67:24  warning  'texture' is defined but never used        no-unused-vars
  69:17  warning  'texture' is defined but never used        no-unused-vars
  71:23  warning  'texture' is defined but never used        no-unused-vars
  71:32  warning  'x' is defined but never used              no-unused-vars
  71:35  warning  'y' is defined but never used              no-unused-vars
  71:38  warning  'width' is defined but never used          no-unused-vars
  71:45  warning  'height' is defined but never used         no-unused-vars
  75:19  warning  'attribute' is defined but never used      no-unused-vars
  77:24  warning  'attribute' is defined but never used      no-unused-vars
  79:19  warning  'attribute' is defined but never used      no-unused-vars
  81:20  warning  'attribute' is defined but never used      no-unused-vars
  89:14  warning  'name' is defined but never used           no-unused-vars

/Users/herbst/git/three/examples/jsm/renderers/webgpu/WebGPUBackend.js
  24:19  error  Parsing error: Cannot use keyword 'await' outside an async function

/Users/herbst/git/three/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js
  136:27  warning  'VideoFrame' is not defined  no-undef

This contribution is funded by Needle

@LeviPesin
Copy link
Contributor

Parsing error: Cannot use keyword 'await' outside an async function

I think we should configure the linter to support top-level await?

Parsing error: Unexpected token import

And dynamic imports?

@@ -767,7 +767,7 @@ class LDrawParsedCache {
const text = await fileLoader.loadAsync( subobjectURL );
return text;

} catch {
} catch ( _ ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add also Optional Catch Binding to the linter? It has appeared in the specification only in ES2019 but was supported everywhere for a long time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you maybe do that in a follow-up PR? I'm unfortunately not familiar with configuring the linter (yet)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with it too, actually 😅

@Mugen87 Mugen87 added this to the r155 milestone Jul 10, 2023
@Mugen87 Mugen87 merged commit 1bb77a7 into mrdoob:dev Jul 10, 2023
@hybridherbst hybridherbst deleted the improve-addons-linting branch July 10, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants